package com.netease.b.b.h;

import android.os.Bundle;
import com.netease.b.b.e.f;
import com.netease.b.b.e.j;
import com.netease.b.b.e.k;
import com.netease.framework.a.m;
import com.netease.framework.b.c;
import com.netease.pris.c.l;
import java.net.URLDecoder;
import org.json.JSONException;
import org.json.JSONObject;

public class b extends k
{
  private static final String j = "/oauth/request_token";
  private static final String k = "/oauth2/authorize";
  private static final String l = "/oauth2/access_token";
  private static final int m = 1;
  private static final int n = 2;
  private static final int o = 3;
  private static final int p = 4;
  private static final int q = 5;
  int a = 1;
  String b;

  public b()
  {
    super(4096);
  }

  private j b(String paramString)
  {
    j localj = new j(7);
    com.netease.g.b.e("kaixin", paramString);
    try
    {
      JSONObject localJSONObject = new JSONObject(paramString);
      localj.d(com.netease.c.b.c(localJSONObject.optString("name")));
      localj.e(com.netease.c.b.c(localJSONObject.optString("uid")));
      localj.g("http://www.kaixin001.com/home/?uid=" + localj.f());
      localj.f(com.netease.c.b.c(localJSONObject.optString("logo50")));
      return localj;
    }
    catch (JSONException localJSONException)
    {
      while (true)
      {
        localj = null;
        localJSONException.printStackTrace();
      }
    }
  }

  private m b()
  {
    j localj = new j(7);
    localj.a(1);
    c(0, localj);
    String str = d.a().a("/oauth/request_token");
    return d.a().b().a(com.netease.framework.a.b.a, str, null);
  }

  private m c(String paramString)
  {
    j localj = new j(7);
    localj.a(3);
    c(0, localj);
    StringBuffer localStringBuffer = new StringBuffer(d.a().b("/oauth2/access_token"));
    localStringBuffer.append("?");
    Bundle localBundle = new Bundle();
    localBundle.putString("grant_type", "authorization_code");
    localBundle.putString("client_id", "248858130998b36ac5d42c42b05caa96");
    localBundle.putString("client_secret", "b759b840c0971dbd5fb3af77ec7c39c4");
    if (paramString != null)
      localBundle.putString("code", paramString);
    localBundle.putString("redirect_uri", "http://yuedu.163.com/redirect_uri");
    localStringBuffer.append(d.a(localBundle));
    return new m(localStringBuffer.toString(), com.netease.framework.a.b.a);
  }

  private m f()
  {
    StringBuffer localStringBuffer = new StringBuffer(d.a().a("/oauth2/authorize"));
    localStringBuffer.append("?");
    Bundle localBundle = new Bundle();
    localBundle.putString("client_id", "248858130998b36ac5d42c42b05caa96");
    localBundle.putString("redirect_uri", "http://yuedu.163.com/redirect_uri");
    localBundle.putString("response_type", "code");
    localBundle.putString("scope", "basic create_records");
    localStringBuffer.append(d.a(localBundle));
    j localj = new j(7);
    localj.getClass();
    localj.a(new a(this, localj, localStringBuffer.toString(), "http://yuedu.163.com/redirect_uri"));
    localj.a(2);
    c(0, localj);
    return null;
  }

  public m a()
  {
    j localj = new j(7);
    localj.a(4);
    c(0, localj);
    StringBuffer localStringBuffer = new StringBuffer(d.a().b("/users/me.json"));
    localStringBuffer.append("?");
    Bundle localBundle = new Bundle();
    localBundle.putString("access_token", URLDecoder.decode(d.a().b().d));
    localStringBuffer.append(d.a(localBundle));
    return new m(localStringBuffer.toString(), com.netease.framework.a.b.a);
  }

  protected void a(int paramInt, Object paramObject)
  {
    super.a(paramInt, paramObject);
    if (this.a != 5)
      g().a(this);
    while (true)
    {
      return;
      h();
    }
  }

  public void a(int paramInt, String paramString)
  {
    f localf = d.a().c(paramString);
    d(localf.h, localf);
  }

  public void a(String paramString)
  {
    com.netease.g.b.e("LoninTransaction", paramString);
    switch (this.a)
    {
    case 2:
    default:
    case 1:
    case 3:
    case 4:
    }
    while (true)
    {
      return;
      this.a = (1 + this.a);
      try
      {
        String str3 = new JSONObject(paramString).optString("access_token");
        d.a().a(str3, "null");
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        d(-1, new f(7, -1, null, null));
        this.a = 5;
      }
      continue;
      this.a = (1 + this.a);
      j localj = b(paramString);
      if (localj != null)
      {
        com.netease.g.b.e("LoninTransaction", localj.e() + "|" + localj.f() + "|" + localj.h());
        String str1 = d.a().b().d;
        String str2 = d.a().b().e;
        l.a(com.netease.b.a.d.h().a(), localj.e(), 7, str1, str2, localj.g(), localj.h(), localj.b());
        localj.a(5);
        c(0, localj);
        continue;
      }
      d(-1, new f(7, -1, null, null));
    }
  }

  public void c()
  {
    com.netease.g.b.e("LoninTransaction", "" + this.a);
    Object localObject = null;
    switch (this.a)
    {
    default:
      if ((o()) || (localObject == null))
        break;
      a(localObject);
    case 1:
    case 2:
    case 3:
    case 4:
    }
    while (true)
    {
      return;
      localObject = b();
      break;
      localObject = f();
      break;
      localObject = c(this.b);
      break;
      localObject = a();
      break;
      if (this.a == 2)
        continue;
      h();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.b.b.h.b
 * JD-Core Version:    0.6.0
 */